import { GSprite } from "../../../../com/mui/controls/GSprite";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { ObjCreate } from "../common/ObjCreate";
import { UICompomentPool } from "../../../../com/mui/utils/UICompomentPool";
type int = number;
//class BitmapNumberPanel
    
    export  class BitmapNumberPanel extends GSprite
    {
        constructor()
        {
            super();
            this._numberBmpAry = [];
            return;
        }

        public setNumber(arg1: int): void
        {
            this.clearBmp();
            LoaderHelp.addResCallBack(ResFileConst.NumberPng, this.onLoaded);
            this._number = arg1;
            return;
        }

        /* internal  */onLoaded(): void
        {
            var loc2=null;
            var loc1=this._number.toString();
            var loc3=0;
            var loc4=0;
            while (loc4 < loc1.length) 
            {
                loc2 = ObjCreate.createBitmap("number_" + loc1.charAt(loc4), loc3, 0, this);
                this._numberBmpAry.push(loc2);
                loc3 = loc3 + 23;
                ++loc4;
            }
            return;
        }

        /* internal  */clearBmp(): void
        {
            var loc1=null;
            while (this._numberBmpAry.length > 0) 
            {
                loc1 = this._numberBmpAry.pop();
                loc1.bitmapData = null;
                removeChild(loc1);
                UICompomentPool.disposeUICompoment(loc1);
            }
            return;
        }

        /* internal */ /* var */_numberBmpAry: Array<any>;

        /* internal */ /* var */_number: int=0;
    }
